import { BrandInterface } from "./brand";
import { GoodInterface } from "./good";
import { SalePropertiesType } from "./property";

// Home页面人气推荐类型
export type HotType = {
    id: string,
    picture: string,
    title: string,
    alt: string,
};

// 分类接口
export interface CategoryInterface {
    id: string,
    name: string,
    picture?: string,
};

// Home页面Category类型
export interface HomeCategoryType extends CategoryInterface {
    children: Array<CategoryInterface>,
    goods: Array<GoodInterface>,
};

// 小型分类类型
export type TinyCategoryType = {
    id: string,
    name: string,
    layer: number,
    parent: TinyCategoryType | null,
};

// Home页面Products类型
export interface HomeProductsType extends CategoryInterface {
    saleInfo: string,
    goods: Array<GoodInterface>,
    children: Array<TinyCategoryType>,
};

// 二级分类类型
export interface SubCategoryType extends CategoryInterface {
    goods: Array<GoodInterface>,
    parentId?: string,
    parentName?: string,
    categories?: Array<TinyCategoryType>,
    brands?: Array<BrandInterface>,
    saleProperties?: Array<SalePropertiesType>,
};

// Category页面Category类型
export interface CategoryDataType extends CategoryInterface {
    children: Array<SubCategoryType>,
};

// SubCategory页面商品列表请求参数sortField字段类型
export type GoodListRequestDataSortFieldType = 'publishTime' | 'orderNum' | 'evaluateNum';

// SubCategory页面商品列表请求参数类型
export type GoodListRequestDataType = {
    categoryId: string,
    page: number,
    pageSize: number,
    sortField: GoodListRequestDataSortFieldType,
};

// SubCategory页面商品列表响应数据类型
export type SubCategoryGoodListType = {
    counts: number,
    items: Array<GoodInterface>,
    page: number,
    pageSize: number,
    pages: number,
};